package dataPO;

import util.Message;
import util.Status;

public class CourseStudentRecordPO extends InfoPO {

	private static final long serialVersionUID = 1L;

	private String[] list;
	
	public CourseStudentRecordPO(String[] list) {
		super(InfoPO.CourseStudentRecordPO);
		this.list = list;
	}
	
	public CourseStudentRecordPO(String courseID) {
		super(InfoPO.CourseStudentRecordPO);
		//TODO
	}
	
	public Message regGrade(String userID, String grade) {
		return null;
	}

	public Message getGrade(String userID) {
		
		for(int i = 0; i < this.list.length; i++) {
			if(this.list[i][0].equals(userID)) {
				Message temp = new Message(Status.SUCCESS, this.list[i][1]);
				return temp;
			}
		}
		return new Message(Status.FAIL);
	}
	
	public int getStudentNumber() {
	    return list.length;
	}

    @Override
    public String[] toArray() {
        return this.list;
    }
	
}
